package org.zcl.枚举switch;

/**
 * @PROJECT_NAME:
 * @DESCRIPTION:
 * @USER: ZhuChengLin
 * @DATE: 2021/11/19 18:00
 */

public enum SexType {
    MAN(1, "男"),
    GIRL(2, "女"),
    OTHER(0, "未知"),
    ;
    private int type;
    private String work;

    SexType(int type, String work) {
        this.type = type;
        this.work = work;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getWork() {
        return work;
    }

    public void setWork(String work) {
        this.work = work;
    }

    public static SexType getByType(int type){
        for (SexType constants : values()) {
            if (constants.getType() == type) {
                return constants;
            }
        }
        return OTHER;
    }
}
